#pragma once

#include "DD_ImgCfg.h"
#include "DrawInfoDefine.h"


#ifdef _DD_ImagePro_
#define DD_ImagePro_Mode __declspec(dllexport)
#else
#define DD_ImagePro_Mode __declspec(dllimport)
#endif 

////////////////////////////////////////////////////////
#ifndef _DD_ImagePro_
#ifdef _DEBUG   
#pragma comment(lib, "ImageProd.lib") 
#else
#pragma comment(lib, "ImagePro.lib")
#endif
#endif 

class xhImagePro;
class DD_ImagePro_Mode DD_ImagePro
{
public:
	DD_ImagePro(void);
	~DD_ImagePro(void);

public:
	static int GetFileInfo(char *pFileName,zkImgFileTail *pFileInfo);
	static int GetFileExInfo(char *pFileName,zkImgFileTail *pFileInfo,zkImgCapParam *pCapParam,zkImgAssParam *pAssParam);

public:
	//init
	int Initialize();
	int UnInitialize();
	//set parent hwnd
	int SetHwnd(HWND hWnd,zkScreenMon *pScreen=NULL);
	int RegOnDrawCallBack(OnDrawCallBackFun funCallBack,void *pContext);
	int RegMsgCallBack(ImgProMsgCallBackFun funCallBack,void *pContext);

public:
	//open file,or use SetOrgBuffer
	int LoadFile(char *pFileName);
	//set original bitmapinfo and data 
	int SetImgBuffer(zkImgBitInfo *pImgInfo,BOOL bShareMem = TRUE,BOOL bShowImg = TRUE);

public:
	int GetImageSize(int &nWidth,int &nHeight);

public:
	int Restore();
	//set process mode and parameter
	int Operate(DWORD dwProMode,void *pVoid = NULL);

public:
	//draw data
	int	Draw(void *pVoid = NULL);
	int ImageCtrl(DWORD dwType,void *pVoid = NULL);
	//
	int SaveDispToFile(char *pFileName,void *pVoid = NULL);

public:
	//get image information
	int GetImgBuffer(zkImgBitInfo **ppImgInfo);

public:
	//get return information,reserve
	int GetGrayValue(int x,int y,DWORD &dwGray);
	//
	int GetLineGray(POINT tStart,POINT tEnd,zkImgLineGray **ppLineGray);
	//get the image Histogram information
	int GetHistogramInfo(zkImgHistogram **ppHistogram);

public:
	//save the file
	int SaveFile(char *pFileName,void *pVoid = NULL);

public:
	//draw mark
	int DrawMark(void *pVoid = NULL);

private:
	xhImagePro *m_pxhImagePro;

};
